<%@page contentType="text/html; charset=UTF-8" language="java" %>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.*" %>
<%@page import="com.mew.util.*" %>
<%@page import="com.humyu.school.corebase.*" %>
<% request.setCharacterEncoding("UTF-8");%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script language="JavaScript">
function delete_confirm(){
 if(confirm("删除后将不能恢复，您确认执行删除操作么？")==true){
	return true;
 }
 return false;
}
</script>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form name="form1" method="post" action="<%=com.humyu.servlet.DispatcherServlet.PREFIX%>do">
  <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="800"><br /> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td align="center"> <table width="100%" border="0">
                <tr>
                  <td align="center"><strong><font color="#000000"><a href="<%=com.humyu.servlet.DispatcherServlet.PREFIX%>do?action=DOADDADMIN"  target="mainFrame">添加管理员帐号</a></font></strong></td>
                </tr>
              </table>
              <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#DDF1FB">
                <tr align="center" bgcolor="#CCCCFF"> 
                  <td width="10%" height="30"><strong>登陆名</strong></td>
                  <td width="10%" height="30"><strong>姓名</strong></td>
                  <td width="10%" height="30"><strong>密码</strong></td>
                  <td width="10%" height="30"><strong>手机号码</strong></td>
                  <td width="15%" height="30"><strong>角色</strong></td>
                  <td width="10%" height="30"><strong>状态</strong></td>
                  <td width="15%" height="30"><strong><font color="#000000">添加时间</font></strong></td>
                  <td width="10%" height="30"><strong><font color="#0000FF">权限分配</font></strong></td>
                  <td width="10%" height="30"><strong><font color="#FF0000">删除</font></strong></td>
                </tr>
                <%
          Iterator admins= (Iterator)request.getAttribute("admins");
          if(admins!=null){
		  	      String strRole="";
                  while(admins.hasNext()){
                          Admin admin = (Admin)admins.next();
                          if(admin!=null){
							out.println("<tr align='center'>");
   							out.println("<td>&nbsp;"+admin.getAdminID()+"</td>");
                                                        out.println("<td>&nbsp;"+admin.getName()+"</td>");
						    out.println("<td>&nbsp;"+admin.getAdminPass()+"</td>");
							out.println("<td>&nbsp;"+admin.getMobile()+"</td>");
							if(admin.getRoleID()==0){
								strRole = "超级管理员";
							}
							if(admin.getRoleID()==1){
								strRole = "普通管理员";
							}
							if(admin.getRoleID()==2){
								strRole = "教委领导";
							}
                			if(admin.getRoleID()==3){
								strRole = "社会资源站点管理员";
							}
                			if(admin.getRoleID()==9){
								strRole = "客服人员";
							}
							out.println("<td>&nbsp;"+strRole+"</td>");
							out.println("<td>&nbsp;"+(admin.getStatus()==1?"已启用":"已禁用")+"</td>");
                                                        out.println("<td>&nbsp;"+StringUtil.FormatDatetime(admin.getCreateTime())+"</td>");
							out.println("<td><a href="+com.humyu.servlet.DispatcherServlet.PREFIX+"do?action=PERMISIONMANAGER&adminID="+java.net.URLEncoder.encode(admin.getAdminID(),"utf-8")+">权限分配</a></td>");
                                                        //if(admin.getRoleID()==0){//管理员不允许被删除
														if("admin".equalsIgnoreCase(admin.getAdminID())){
                                                          out.println("<td>-</td>");
                                                        }else{
                                                          out.println("<td><font color='#FF0000'><a href="+com.humyu.servlet.DispatcherServlet.PREFIX+"do?action=DELADMIN&adminID="+java.net.URLEncoder.encode(admin.getAdminID(),"utf-8")+" onclick='return delete_confirm();'>删除</a></font></td>");
                                                        }
                                                        out.println("</tr>");
						  }
				}
		}
  %>
              </table>
              <p> &nbsp;&nbsp;&nbsp;&nbsp; 
                <input type="button" name="Button" value="刷　新" onClick="history.go(0)">
              </p></td>
          </tr>
        </table></td>
    </tr>
  </table>
</form>
</body>
</html>
